import { Router } from "https://deno.land/x/oak/mod.ts";

const router = new Router();
const realPath = Deno.realPathSync('controllers');
for (const dirEntry of Deno.readDirSync('controllers')) 
{    
    const controller = await import(`file://${realPath}/${dirEntry.name}`);
    for(const key in controller.default)
    {   
        router.get(`/${controller.name}/${key}`, controller.default[key]);
    }
   
}

export default router;